package com.ls.rbac.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * 
 * </p>
 *
 * @author liusheng
 * @since 2025--06--28
 */
@Data
@TableName("sys_permission")
@Schema(name = "Permission", description = "")
public class Permission implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 权限id
     */
    @Schema(description = "权限id")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 权限标识
     */
    @Schema(description = "权限标识")
    private String permissionLabel;

    /**
     * 上级权限id
     */
    @Schema(description = "上级权限id")
    private Integer pid;

    /**
     * 上级权限标识
     */
    @Schema(description = "上级权限标识")
    private String parentLabel;

    /**
     * 权限编码
     */
    @Schema(description = "权限编码")
    private String permissionCode;

    /**
     * 路由地址
     */
    @Schema(description = "路由地址")
    private String routerPath;

    /**
     * 路由名称
     */
    @Schema(description = "路由名称")
    private String routerName;

    /**
     * 路由链接
     */
    @Schema(description = "路由链接")
    private String routerUrl;

    /**
     * 权限类型：0-根目录，1-菜单，2-按钮
     */
    @Schema(description = "权限类型：0-根目录，1-菜单，2-按钮")
    private Integer permissionType;

    /**
     * 图标
     */
    @Schema(description = "图标")
    private String icon;

    /**
     * 排序号
     */
    @Schema(description = "排序号")
    private Integer orderNum;

    /**
     * 创建时间
     */
    @Schema(description = "创建时间")
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    @Schema(description = "更新时间")
    private LocalDateTime updateTime;

    /**
     * 备注
     */
    @Schema(description = "备注")
    private String remark;

    /**
     * 删除状态：0-正常，1-已删除
     */
    @Schema(description = "删除状态：0-正常，1-已删除")
    private Byte deleted;
    @TableField(exist = false)
    @JsonInclude(JsonInclude.Include.NON_NULL)  // 忽略null字段
    private List<Permission> children;

}
